{
    "data": [
        {
            "x":[1,2,3],
            "y":[2,3,4]
        }
    ],
    "layout" : {
        "title":"Plotly Plot"
    }
}
library(plotly)
x = plot_ly(economics, x = ~pop, type='histogram')
x

Python API

Install plotly library with pip…

pip install plotly 

… or with anaconda.

conda install plotly

Simple example

import plotly
import plotly.graph_objs as go

my_plot_div = plotly.offline.plot({
    "data": [go.Scatter(
                x=[1, 2, 3, 4], 
                y=[4, 3, 2, 1]
            )],
    "layout": go.Layout(title="hello world")
},  output_type='div')

print(my_plot_div)

Plotly in Jupyter Notebook

plotly.offline.init_notebook_mode()

plotly.offline.iplot({
    "data": [go.Scatter(x=[1, 2, 3, 4], y=[4, 3, 2, 1])]
})